<?php
namespace App\telegram;

enum FileType: string {
  case PHOTO = 'photo';
  case VIDEO = 'video';
  case FILE = 'file';
  case PACKAGE = 'package';

  
  public function defaultPerfix() :string{
    return match($this){
      self::PHOTO =>  'P_',
      self::VIDEO =>  'V_',
      self::FILE  =>  'D_',
      self::PACKAGE =>  'PK_',
    };
  }

  public function text():string{
    return match($this){
      self::PHOTO =>  '图片',
      self::VIDEO =>  '视频',
      self::FILE  =>  '文件',
      self::PACKAGE =>  '打包/文件',
    };
  }

  public function perfix(array $perfixs){
    if(array_key_exists($this->value, $perfixs)){
      return $perfixs[$this->value];
    }
    return $this->defaultPerfix();
  }
}